var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2Zombie = require("Zombie");
var $2StateComponent = require("StateComponent");
var $2KDefine = require("KDefine");
var $2BundleManager = require("BundleManager");
var $2BowlingUI = require("BowlingUI");
var $2AudioManager = require("AudioManager");
var $2ExcelManager = require("ExcelManager");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_putongjianguo = /* */function (_cc$Component87) {
  babel_inherits(g, _cc$Component87);
  var _super109 = babel_createSuper(g);
  function g() {
    var _this261;
    babel_classCallCheck(this, g);
    _this261 = _super109.apply(this, arguments);
    _this261.dragon = null;
    _this261.vy = 0;
    _this261.vx = 300;
    _this261.is_move = false;
    _this261.type = 0;
    _this261.blq_zaxiang = [];
    _this261.blq_js = [];
    return _this261;
  }
  babel_createClass(g, [{
    key: "onLoad",
    value: function onLoad() {
      this.dragon = this.node.getComponent(sp.Skeleton);
      this.setSkin(1);
      this.blq_zaxiang = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.blq_zaxiang);
      this.vx = this.blq_zaxiang[2].val;
      this.blq_js = $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.blq_js);
    }
  }, {
    key: "setSkin",
    value: function setSkin() {
      var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
      var t = ["jianguo/jianguo_1", "jianguo/jianguo_4"];
      this.type = e;
      this.dragon.defaultSkin = t[e];
      this.dragon.setSkin(t[e]);
    }
  }, {
    key: "move",
    value: function move(e) {
      if (this.is_move) {
        this.node.x += e * this.vx;
        this.node.y += e * this.vy;
      }
    }
  }, {
    key: "setVy",
    value: function setVy(e) {
      this.vy = e;
    }
  }, {
    key: "reduceHp",
    value: function reduceHp() {
      for (var _e147 in this.blq_js) {
        ;
      }
    }
  }, {
    key: "onCollisionEnter",
    value: function onCollisionEnter(e, t) {
      console.log("on collision enter", e.node.name, t.node.name);
      if ("geban" == e.node.name) {
        this.setVy(-this.vy);
      } else {
        this.setVy(1 * this.vx);
        var _t94 = Math.random() > .5 ? 1 : -1;
        this.setVy(_t94 * this.vy);
        var _a71 = e.node.position;
        var _n95 = e.node.getComponent($2Zombie.default).allHp / e.node.getComponent($2Zombie.default).count;
        e.node.getComponent($2Zombie.default).allequipHp > 0 && (_n95 = e.node.getComponent($2Zombie.default).allequipHp / e.node.getComponent($2Zombie.default).count);
        e.node.getComponent($2Zombie.default).hurt(_n95);
        e.node.getComponent($2Zombie.default).hp <= 0 && e.node.getComponent($2StateComponent.default).setState($2KDefine.State.dead);
        if (1 === this.type) {
          $2AudioManager.default.instance.playEffect("blq_bomb");
          var _e148 = new cc.Node();
          _e148.name = "Fx3";
          _e148.parent = cc.find("Canvas");
          _e148.setPosition(this.node.position);
          this.node.removeFromParent();
          var _t95 = _e148.addComponent(sp.Skeleton);
          $2BundleManager.default.instance.loadBundleRes("Spine", "BowlingUI/FX3/FX3", sp.SkeletonData, function () {
            _t95.skeletonData = $2BundleManager.default.instance.getBundleRes("Spine", "BowlingUI/FX3/FX3", sp.SkeletonData);
            _t95.defaultSkin = "default";
            _t95.setSkin("default");
            _t95.setAnimation(0, "FX3", false);
            $2BowlingUI.default.instance.hsjianguo(_a71);
            _t95.setCompleteListener(function (e) {
              e.animation.name && e.animation.name;
            });
          });
        } else {
          $2AudioManager.default.instance.playEffect("blq_pt_bomb");
        }
      }
    }
  }, {
    key: "update",
    value: function update(e) {
      this.move(e);
      (this.node.x > cc.winSize.width || this.node.y > cc.winSize.height || this.node.y < -cc.winSize.height) && this.node.removeFromParent();
    }
  }]);
  return g;
}(cc.Component);
def_putongjianguo = cc__decorate([ccp_ccclass], def_putongjianguo);
exports.default = def_putongjianguo;